/* Copyright (c) [2023] [ylc]. Licensed under Apache-2.0 License. */

#ifndef __MY_WS2812B_H
#define __MY_WS2812B_H

#include "my_define.h"

#define WS2812B_H()	P00=1
#define WS2812B_L()	P00=0


#define DELAY_100NS()	_nop_();_nop_();_nop_();_nop_();_nop_();
#define DELAY_850NS()	DELAY_100NS();DELAY_100NS();DELAY_100NS();DELAY_100NS();DELAY_100NS();DELAY_100NS();DELAY_100NS()

#define PIXEL_NUM	18	//LED灯的个数

typedef union{
	struct{
		u8 bak;
		u8 G;
		u8 R;
		u8 B;
	}color;
	u32 value;
}WS2812B_COLOR_T;


extern WS2812B_COLOR_T PixelBuf[PIXEL_NUM]; //像数数据

void my_2812_init(void);
void ws2812b_reset(void);
void ws2812b_write_byte(u8 dat);
void ws2812b_write_color(WS2812B_COLOR_T *pColor);
void ws2812b_refresh(void);
void ws2812b_test(void);


#endif
